package ch02;

/**
 * @author chenmin
 * @desc TODO
 * @date 2025/9/2
 */
public class For5 {
    public static void main(String[] args) {
        int wellDepth = 7;
        int dayClimb = 3;
        int nightDrop = 2;
        int currentDepth = 0;
        int days = 0;
        while (currentDepth < wellDepth) {
            days++;
            currentDepth += dayClimb;
            if (currentDepth >= wellDepth) {
                break;
            }
            currentDepth -= nightDrop;
        }
        System.out.println("青蛙" + days + "天能爬出这口井");
    }
}

